package cn.wolfcode.luowowo.website.web.controller;


import cn.wolfcode.luowowo.article.domain.Answer;
import cn.wolfcode.luowowo.article.domain.AnswerComment;
import cn.wolfcode.luowowo.article.service.IAnswerService;
import cn.wolfcode.luowowo.comment.service.IAnswerCommentService;
import cn.wolfcode.luowowo.member.domain.UserInfo;
import cn.wolfcode.luowowo.website.annoation.LoginCheck;
import cn.wolfcode.luowowo.website.annoation.UserParam;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("answer")
public class AnswerController {
    @Reference
    private IAnswerService answerService;

    @Reference
    private IAnswerCommentService answerCommentService;


    //需要登陆才能回答问题
    @RequestMapping("saveOrUpdate")
    @LoginCheck
    public String saveOrUpdate(@UserParam UserInfo userInfo, Answer answer){
        answer.setUserInfo(userInfo);
        answerService.saveOrUpdate(answer);
        return "questions/wendaDetail";
    }



}